﻿using FX_API.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FX_API.Factory
{
    public class QueryModelFactory
    {
        public static Data CreateQuerySearchData(
            int limit,
            int offset,
            string apiName,
            List<OrdersItem> orderRules,
            List<string> fieldProjection,
            List<FiltersItem> filterRules)
        {
            return new Data()
            {
                dataObjectApiName = apiName,
                search_query_info = new Search_query_info()
                {
                    limit = limit,
                    offset = offset,
                    orders = orderRules,
                    fieldProjection = fieldProjection,
                    filters = filterRules
                }
            };
        }

        public static FXQueryInfo CreateQueryInfoWithData(Data data)
        {
            return new FXQueryInfo()
            {
                corpAccessToken = FenxiangAPI.corpAccessToken,
                corpId = FenxiangAPI.corpId,
                currentOpenUserId = FenxiangAPI.openUserId,
                data = data
            };
        }
    }
}
